<extend name="layout/main" />

<block name="HEADER">

</block>

<block name="CONTENT">
	<control:grid id="grid" />
</block>

<block name="FOOTER">
	<script type="text/javascript">
		var page = (function(ns){
            

            //页面初始化
            ns.init=function(){
				window.socket.onMessage = function(result){
					if( result.type == 'update' ){
						grid.getRows().map(function(h){
							if(h.id == result.body.id){
								grid.silentLoad();
							}
						})
					}
				}
            }
		    
		    //新增
		    ns.add=function(){
		    	var filter = {
		            url:$.getModule('edit'),
		            oid:"",
		            mode:1
		        }
		        $.openIframe(filter, "新增",['600px', '500px']);
		    }
		    
		    //编辑
		    ns.edit=function(mode){
		        var filter = {
		            url: $.getModule('edit'),
		            oid: grid.getSelectedColumnValue() ,
		            mode: 2
		        }
		        $.openIframe(filter, "编辑",['600px', '500px']);
		    }  

			//frps列表
		    ns.frps = function(){
		    	var filter = {
		            url:$.getModule('frps'),
		            oid: grid.getSelectedColumnValue(),
		            mode:1
		        }
		        $.openIframe(filter, "frps列表",['80%', '80%']);
		    }

			//reset
		    ns.reset = function(id){
		        $.confirm("将会清空节点数据，确定重置？", function(){
		            $.ajaxs("/admin/v1/nodes/reset",{
						id:id
					}).then(function(res){
		                $.toast(1,res.msg);
		            });
		        });
		    } 
		    
		    return ns;
		}({}));
		
		
		$(function(){ page.init();  });

	</script>
</block>